import { numPositiveNumber, numTwoDecimal } from '@/utils/formRules';
import { reactive } from 'vue';

//设备信息
const materBaseEquipment = reactive([
	{
		type: 'text',
		label: '设备名称',
		isDisabled: true,
		labelWidth: '100px',
		bindFieldName: 'deviceName',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '设备品牌',
		isDisabled: true,
		bindFieldName: 'deviceBrand',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '设备规格',
		isDisabled: true,
		bindFieldName: 'deviceSpecifications',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '设备编号',
		isDisabled: true,
		bindFieldName: 'deviceNum',
		bindFieldVal: '',
	},
	{
		type: 'select',
		label: '楼层',
		isDisabled: true,
		optionList: [],
		keyName: 'dictValue',
		valName: 'dictLabel',
		bindFieldName: 'floorNum',
		bindFieldVal: '',
		placeholder: ' ',
	},
	{
		type: 'text',
		label: '设备位置',
		isDisabled: true,
		bindFieldName: 'deviceLocation',
		bindFieldVal: '',
	},
	{
		type: 'text',
		inputType: 'textarea',
		label: '说明',
		isDisabled: true,
		bindFieldName: 'remark',
		bindFieldVal: '',
	},
]);

//质保信息
const materBaseQuality = reactive([
	{
		type: 'date',
		inputType: 'datetime',
		format: 'YYYY-MM-DD HH:mm:ss',
		label: '开始日期',
		isDisabled: true,
		labelWidth: '100px',
		bindFieldName: 'warrantyStartTime',
		bindFieldVal: '',
		placeholder: ' ',
	},
	{
		type: 'date',
		inputType: 'datetime',
		format: 'YYYY-MM-DD HH:mm:ss',
		label: '结束日期',
		isDisabled: true,
		bindFieldName: 'warrantyEndTime',
		bindFieldVal: '',
		placeholder: ' ',
	},
	{
		type: 'text',
		label: '质保期',
		isDisabled: true,
		bindFieldName: 'effectState',
		bindFieldVal: '',
	},
]);

//寿命信息
const materBaseLife = reactive([
	{
		type: 'date',
		inputType: 'datetime',
		format: 'YYYY-MM-DD HH:mm:ss',
		label: '开始日期',
		isDisabled: true,
		labelWidth: '100px',
		bindFieldName: 'lifeStartTime',
		bindFieldVal: '',
		placeholder: ' ',
	},
	{
		type: 'date',
		inputType: 'datetime',
		format: 'YYYY-MM-DD HH:mm:ss',
		label: '结束日期',
		isDisabled: true,
		bindFieldName: 'lifeEndTime',
		bindFieldVal: '',
		placeholder: ' ',
	},
	{
		type: 'text',
		label: '寿命期',
		isDisabled: true,
		bindFieldName: 'lifeEffectState',
		bindFieldVal: '',
	},
]);

//设备状态
const materBaseStatus = reactive([
	{
		type: 'select',
		label: '设备状态',
		isDisabled: true,
		labelWidth: '100px',
		optionList: [],
		keyName: 'id',
		valName: 'dictLabel',
		bindFieldName: 'deviceStatusDict',
		bindFieldVal: '',
		placeholder: ' ',
	},
]);

//水表参数信息
const materBaseParams = reactive([
	{
		type: 'select',
		label: '水表类型',
		isRequired: true,
		optionList: [],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'waterMeterType',
		bindFieldVal: '',
	},
	{
		type: 'select',
		label: '水表种类',
		isRequired: true,
		optionList: [],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'waterMeterModel',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '倍率',
		isRequired: true,
		bindFieldName: 'multiplier',
		bindFieldVal: '',
		maxlength: 18,
		rules: [{ validator: numPositiveNumber(), trigger: ['change', 'blur'] }],
	},
	{
		type: 'select',
		label: '所属父级',
		isRequired: false,
		optionList: [],
		keyName: 'deviceId',
		valName: 'deviceName',
		bindFieldName: 'parentDeviceId',
		bindFieldVal: '',
	}
]);

//电表参数信息
const materEleBaseParams = reactive([
	{
		type: 'select',
		label: '电表类型',
		isRequired: true,
		optionList: [],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'electricMeterType',
		bindFieldVal: '',
	},
	{
		type: 'select',
		label: '电表种类',
		isRequired: true,
		isDisabled: false,
		optionList: [],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'electricMeterModel',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '倍率',
		isRequired: true,
		bindFieldName: 'multiplier',
		bindFieldVal: '',
		maxlength: 18,
		rules: [{ validator: numPositiveNumber(), trigger: ['change', 'blur'] }],
	},
	{
		type: 'select',
		label: '所属父级',
		isRequired: false,
		optionList: [],
		keyName: 'deviceId',
		valName: 'deviceName',
		bindFieldName: 'parentDeviceId',
		bindFieldVal: '',
	}
]);

//抄表合同信息
const materCopyContract = reactive([
	{
		type: 'text',
		label: '铺位编号',
		isDisabled: true,
		labelWidth: '122px',
		bindFieldName: 'storeCode',
		bindFieldVal: '',
	},
	// {
	// 	type: 'text',
	// 	label: '商户名称',
	// 	isDisabled: true,
	// 	bindFieldName: 'aa',
	// 	bindFieldVal: '',
	// },
	{
		type: 'text',
		label: '品牌名称',
		isDisabled: true,
		bindFieldName: 'brandName',
		bindFieldVal: '',
	},
]);

//抄表水表信息
const materCopyWater = reactive([
	{
		type: 'text',
		label: '水表编号',
		isDisabled: true,
		labelWidth: '122px',
		bindFieldName: 'deviceNum',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '倍率',
		isDisabled: true,
		bindFieldName: 'multiplier',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '楼层',
		isDisabled: true,
		bindFieldName: 'floorNum',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '水表位置',
		isDisabled: true,
		bindFieldName: 'deviceLocation',
		bindFieldVal: '',
	},
]);

//抄表读数 水表 | 电表
const materCopyReading = reactive([
	{
		type: 'text',
		label: '上次读数',
		isDisabled: true,
		labelWidth: '122px',
		bindFieldName: 'beforeUncle',
		bindFieldVal: '',
	},
	{
		type: 'date',
		label: '上次抄表日期',
		isDisabled: true,
		bindFieldName: 'pushTime',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '本次读数',
		isRequired: true,
		bindFieldName: 'currentUncle',
		bindFieldVal: '',
		rules: [{ validator: numTwoDecimal(true), trigger: ['change', 'blur'] }],
	},
	{
		type: 'text',
		label: '用量',
		isDisabled: true,
		bindFieldName: 'dosage',
		bindFieldVal: '',
	},
	{
		type: 'file',
		label: '附件',
		limit: 10,
		baseUrl: process.env.VUE_APP_BASE_API_ZK,
		fileSize: 1000,
		acceptType: '*',
		multiple: false,
		isDisabled: false,
		bindFieldName: 'attachmentUrlList',
		bindFieldVal: [],
	},
]);

//抄表读数 电表 (新)
const materCopyEleReading = reactive([
	{
		type: 'text',
		label: '系数',
		isDisabled: true,
		labelWidth: '122px',
		bindFieldName: 'coefficient',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '单价',
		isDisabled: true,
		bindFieldName: 'unitPrice',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '上次读数',
		isDisabled: true,
		bindFieldName: 'beforeUncle',
		bindFieldVal: '',
	},
	{
		type: 'date',
		label: '上次抄表日期',
		isDisabled: true,
		bindFieldName: 'beforeTime',
		bindFieldVal: '',
		placeholder:" "
	},
	{
		type: 'text',
		label: '本次读数',
		isRequired: true,
		bindFieldName: 'currentUncle',
		bindFieldVal: '',
		rules: [{ validator: numTwoDecimal(true), trigger: ['change', 'blur'] }],
	},
	{
		type: 'date',
		label: '本次抄表日期',
		isRequired: true,
		bindFieldName: 'currentTimes',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '倍率',
		isDisabled: true,
		bindFieldName: 'multiplier',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '用量',
		isDisabled: true,
		bindFieldName: 'dosage',
		bindFieldVal: '',
		labelTooltip:true,
		labelTooltipTxt:"(本次读数 - 上次读数)*倍率"
	},
	{
		type: 'text',
		label: '费用',
		isDisabled: true,
		bindFieldName: 'sum',
		bindFieldVal: '',
		labelTooltip:true,
		labelTooltipTxt:"用量*单价*系数"
	},
	{
		type: 'text',
		inputType: 'textarea',
		label: '备注',
		bindFieldName: 'remark',
		bindFieldVal: '',
	},
	{
		type: 'file',
		label: '附件',
		limit: 10,
		baseUrl: process.env.VUE_APP_BASE_API_ZK,
		fileSize: 1000,
		acceptType: '*',
		multiple: false,
		isDisabled: false,
		bindFieldName: 'attachmentList',
		bindFieldVal: [],
	},
]);

//解表合同信息
const breakSignContract = reactive([
	{
		type: 'text',
		label: '资产类型',
		isDisabled: true,
		labelWidth: '110px',
		bindFieldName: 'unitTypeValue',
		bindFieldVal: '',
	},
	// {
	// 	type: 'text',
	// 	label: '楼层',
	// 	isDisabled: true,
	// 	bindFieldName: 'aa',
	// 	bindFieldVal: '',
	// },
	{
		type: 'text',
		label: '资产编号',
		isDisabled: true,
		bindFieldName: 'assetsPromoteNum',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '面积',
		isDisabled: true,
		bindFieldName: 'contractSignArea',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '品牌名称',
		isDisabled: true,
		bindFieldName: 'brandName',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '合同编号',
		isDisabled: true,
		bindFieldName: 'contractCode',
		bindFieldVal: '',
	},
]);

//解 | 挂 表基础信息 水
const breakSignWaterInfo = [
	{
		type: 'select',
		isRemote: true,
		label: '水表编号',
		isRequired: true,
		isHide: true,
		optionList: [],
		labelWidth: '110px',
		keyName: 'waterMeterId',
		valName: 'waterMeterCode',
		bindFieldName: 'waterMeterId',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '水表编号',
		isDisabled: true,
		isHide: true,
		labelWidth: '110px',
		bindFieldName: 'waterMeterCode',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '水表名称',
		isDisabled: true,
		bindFieldName: 'waterMeterName',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '所在楼层',
		isDisabled: true,
		bindFieldName: 'floorNum',
		bindFieldVal: '',
	},
	{
		type: 'text',
		inputType: 'textarea',
		label: '所在位置',
		isDisabled: true,
		bindFieldName: 'deviceLocation',
		bindFieldVal: '',
	},
	{
		type: 'select',
		label: '表类型',
		isDisabled: true,
		optionList: [
			{ id: 1, label: '预付费' },
			{ id: 2, label: '后付费' },
		],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'waterMeterType',
		bindFieldVal: '',
		placeholder: ' ',
	},
	{
		type: 'select',
		label: '表种类',
		isDisabled: true,
		optionList: [
			{ id: 1, label: '普通能源表' },
			{ id: 2, label: '智能表' },
		],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'waterMeterModel',
		bindFieldVal: '',
		placeholder: ' ',
	},
]

//解 | 挂 表基础信息 电
const breakSignEleInfo = [
	{
		type: 'select',
		isRemote: true,
		label: '电表编号',
		isRequired: true,
		isHide: true,
		optionList: [],
		labelWidth: '110px',
		keyName: 'electricMeterId',
		valName: 'electricMeterCode',
		bindFieldName: 'electricMeterId',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '电表编号',
		isDisabled: true,
		isHide: true,
		labelWidth: '110px',
		bindFieldName: 'electricMeterCode',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '电表名称',
		isDisabled: true,
		bindFieldName: 'electricMeterName',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '所在楼层',
		isDisabled: true,
		bindFieldName: 'floorNum',
		bindFieldVal: '',
	},
	{
		type: 'text',
		inputType: 'textarea',
		label: '所在位置',
		isDisabled: true,
		bindFieldName: 'deviceLocation',
		bindFieldVal: '',
	},
	{
		type: 'select',
		label: '表类型',
		isDisabled: true,
		optionList: [
			{ id: 1, label: '预付费' },
			{ id: 2, label: '后付费' },
		],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'electricMeterType',
		bindFieldVal: '',
		placeholder: ' ',
	},
	{
		type: 'select',
		label: '表种类',
		isDisabled: true,
		optionList: [
			{ id: 1, label: '普通能源表' },
			{ id: 2, label: '智能表' },
		],
		keyName: 'id',
		valName: 'label',
		bindFieldName: 'electricMeterModel',
		bindFieldVal: '',
		placeholder: ' ',
	},
]

//解 | 挂 表基础信息 公共
const breakSignInfo = reactive([
	{
		type: 'text',
		label: '倍率',
		isDisabled: true,
		bindFieldName: 'multiplier',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '计费系数',
		isDisabled: true,
		isRequired: true,
		maxlength: 8,
		bindFieldName: 'coefficient',
		bindFieldVal: '',
		rules: [{ validator: numTwoDecimal(true), trigger: ['change', 'blur'] }],
	},
	{
		type: 'text',
		label: '解表读数',
		isRequired: true,
		isDisabled: false,
		isHide: true,
		maxlength: 8,
		bindFieldName: 'surfaceReading',
		bindFieldVal: '',
		rules: [{ validator: numTwoDecimal(true), trigger: ['change', 'blur'] }],
	},
	{
		type: 'text',
		label: '挂表读数',
		isRequired: true,
		isDisabled: false,
		isHide: true,
		maxlength: 8,
		bindFieldName: 'meterReading',
		bindFieldVal: '',
		rules: [{ validator: numTwoDecimal(true), trigger: ['change', 'blur'] }],
	},
]);

const chargeRules = reactive([
	{
		type: 'date',
		inputType: 'datetime',
		format: 'YYYY-MM-DD HH:mm:ss',
		label: '生效时间',
		isRequired: true,
		labelWidth: '100px',
		bindFieldName: 'effectiveTime',
		bindFieldVal: '',
	},
	{
		type: 'date',
		inputType: 'datetime',
		format: 'YYYY-MM-DD HH:mm:ss',
		label: '失效时间',
		isRequired: true,
		bindFieldName: 'expiresTime',
		bindFieldVal: '',
	},
	{
		type: 'text',
		label: '生效状态',
		isDisabled: true,
		bindFieldName: 'effectState',
		bindFieldVal: '',
	},
]);

export { materBaseEquipment, materBaseQuality, materBaseLife, materBaseStatus, materBaseParams, materEleBaseParams, materCopyContract, materCopyWater, materCopyReading, materCopyEleReading, breakSignContract, breakSignWaterInfo, breakSignEleInfo, breakSignInfo, chargeRules };
